#ifndef _EVENTS_
#define _EVENTS_

#include "Map.h"

#define menuHeight 64
#define shopWidth (((gameState & GAME_STATE_SHOP) || ((oldState & GAME_STATE_SHOP) && (clock() - stateTime < 0))) ? (min(abs(clock() - stateTime), 128) * 2) : 0)

#define mapWidth (map->width * 16)
#define mapHeight (map->height * 16)
#define mapLeft ((mapWidth > SCREEN_W - shopWidth) ? 0 : (shopWidth + (SCREEN_W - shopWidth - mapWidth) / 2))
#define mapTop ((mapHeight > SCREEN_H - menuHeight) ? 0 : (menuHeight + (SCREEN_H - menuHeight - mapHeight) / 2))

#define mouseX (mouse_x + 4)
#define mouseY (mouse_y + 1)

#define cursorX (((mouseX - mapLeft) / 16) - ((mouseX - mapLeft) < 0))
#define cursorY (((mouseY - mapTop) / 16) - ((mouseY - mapTop) < 0))
#define cursorPosition CreateCoord(cursorX, cursorY)

int KeyboardCallback(int keyCode);
void MouseCallback(int flags);
void ExitButtonCallBack();

#endif
